PASS Lists
As discussed in the previous section, the PASS statement allows an area to be passed to the next subroutine, process, or external program that is executed via a GOSUB, CALL, RUN, or process-type statement (i.e., INPUT, INQUIRY, JOB, MENU, OUTPUT, QUERY, STATUS, SUBR, UPDATE), or to the next automatic or optional child process that is run. Prior to APPX 4.1, there was only one PASS list which was cleared upon completion of a CALL or RUN statement. Now it is possible to have a series of PASS lists. Each PASS statement adds its area to a single list until the execution of a GOSUB, CALL, RUN, or process-type statement, or the invocation of a automatic or optional child process. Upon such execution, only the values in the current PASS list are passed. However, if executing an APPX subroutine or process, it can in turn execute PASS statements. These statements then build another PASS list until terminated in the same manner. Each PASS list is cleared when execution returns to the routine or level which established it.
The following code provides an example of the use of three separate PASS lists. The first PASS list holds values for CUSTOMER NAME and CUSTOMER ADDRESS. The second PASS list contains the value for AREA MAIL CODE, and this is the only value passed to the :PROCESS MAIL CODE subroutine. The second PASS list is then cleared upon return from this subroutine while the first PASS list remains intact until the return from the :PROCESS NAME & ADDRESS subroutine. As illustrated in our example, values from the first PASS list do not have to be RECEIVE'd before initiating another PASS list. Finally, a third PASS list is established for the CUSTOMER BALANCE value, which is finally cleared upon return from the :PROCESS BALANCE subroutine.
|